package com.betterjr.modules.commission.dubbo;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.dubbo.config.annotation.Service;
import com.betterjr.common.web.AjaxObject;
import com.betterjr.modules.commission.entity.CommissionBusPaymentCode;
import com.betterjr.modules.commission.service.CommissionPayBankResultService;
import com.betterjr.modules.commissionfile.ICommissionPayBankCode;
import com.betterjr.modules.rule.service.RuleServiceDubboFilterInvoker;

/**
 * 
 * @ClassName: CommissionPayBankCodeDobboService 
 * @Description: TODO(这里用一句话描述这个类的作用) 
 * @author chenlq
 * @date 2017年10月17日 下午1:55:49 
 *
 */
@Service(interfaceClass = ICommissionPayBankCode.class)
public class CommissionPayBankCodeDobboService implements ICommissionPayBankCode {

    @Autowired
    private CommissionPayBankResultService commissionPayBankCodeService;

    @Override
    public String webQueryPayBankCodeInfo(Map<String, Object> anParam, String anFlag, int anPageNum, int anPageSize) {
        final Map<String, Object> queryMap = RuleServiceDubboFilterInvoker.getInputObj();
        // 返回数据封装成Json
        return AjaxObject.newOkWithPage("直通车代码查询成功",
                commissionPayBankCodeService.queryCommissionPayBankResult(queryMap, anFlag, anPageNum, anPageSize))
                .toJson();
    }

    @Override
    public String webSavePayBankCodeInfo(Map<String, Object> anParamMap) {
        final CommissionBusPaymentCode bankPaymentCodeInfo = RuleServiceDubboFilterInvoker.getInputObj();
        return AjaxObject.newOk("直通车代码新增成功", commissionPayBankCodeService.saveAddBankPayCodeInfo(bankPaymentCodeInfo))
                .toJson();
    }

    @Override
    public String webSaveUpdataBankCodeInfo(Map anParamMap) {
        final CommissionBusPaymentCode bankPaymentCodeInfo = RuleServiceDubboFilterInvoker.getInputObj();
        return AjaxObject
                .newOk("直通车代码修改成功", commissionPayBankCodeService.saveUpdataBankPayCodeInfo(bankPaymentCodeInfo))
                .toJson();
    }

}
